gdk: Stop using gdk_device_get_position
authorMatthias Clasen <mclasen@redhat.com>
Tue, 26 Mar 2019 00:26:34 +0000 (20:26 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 26 Mar 2019 22:12:55 +0000 (18:12 -0400)
We should always use the double variant of this api.

gdk/win32/gdkdrag-win32.c
gdk/x11/gdkdrag-x11.c

index 6b9d115419080b8a74863bc6f4541cf9b23eda52..5583ac94218882f04ee68fa80326347db3e269af 100644 (file)
@@ -1717,6 +1717,7 @@ _gdk_win32_surface_drag_begin (GdkSurface         *surface,
   GdkDrag *drag;
   GdkWin32Drag *drag_win32;
   GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
+  double px, py;
   int x_root, y_root;
 
   g_return_val_if_fail (surface != NULL, NULL);
@@ -1731,9 +1732,9 @@ _gdk_win32_surface_drag_begin (GdkSurface         *surface,
 
   GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
 
-  gdk_device_get_position (device, &x_root, &y_root);
-  x_root += dx;
-  y_root += dy;
+  gdk_device_get_position_double (device, &px, &px);
+  x_root = round (px) + dx;
+  y_root = round (py) + dy;
 
   drag_win32->start_x = x_root;
   drag_win32->start_y = y_root;
index db2abcdc5cb62e095eaca230640e39a05fcc9ff3..4305bdaf13a3843b97be4336481a77e83aa74177 100644 (file)
@@ -2077,6 +2077,7 @@ _gdk_x11_surface_drag_begin (GdkSurface         *surface,
   GdkX11Drag *x11_drag;
   GdkDrag *drag;
   GdkDisplay *display;
+  double px, py;
   int x_root, y_root;
   Atom xselection;
   GdkSurface *ipc_surface;
@@ -2097,9 +2098,9 @@ _gdk_x11_surface_drag_begin (GdkSurface         *surface,
 
   precache_target_list (drag);
 
-  gdk_device_get_position (device, &x_root, &y_root);
-  x_root += dx;
-  y_root += dy;
+  gdk_device_get_position_double (device, &px, &py);
+  x_root = round (px) + dx;
+  y_root = round (py) + dy;
 
   x11_drag->start_x = x_root;
   x11_drag->start_y = y_root;